﻿using ServiceCore.Entity.Model;

namespace ServiceCore.Entity.Const
{
    public class GlobalVar
    {
        /// <summary>
        /// 枚举列表
        /// </summary>
        public static List<EnumInfo> lstEnum { get; set; }

        /// <summary>
        /// 获取枚举值
        /// </summary>
        /// <param name="constId"></param>
        /// <param name="EnumParentId"></param>
        /// <returns></returns>
        public static string GetEnumVal(string constId, string EnumParentId = "")
        {
            if (string.IsNullOrEmpty(EnumParentId))
                return lstEnum.Where(x => x.EnumId == constId).Select(x => x.EnumValue).FirstOrDefault();
            else
                return lstEnum.Where(x => x.EnumId == constId && x.EnumParentId == EnumParentId).Select(x => x.EnumValue).FirstOrDefault();

        }
    }
}
